home *** CD-ROM | disk | FTP | other *** search
/ Internet E-Mail Workshop / Internet E-Mail Workshop.iso / info / botdoc. < prev    next >
Internet Message Format  |  1993-03-27  |  19KB

  1. From jlynch@wilkes1.wilkes.edu Wed Jul  8 02:29:58 1992
  2. Received: by wilkes1.wilkes.edu (5.57/Ultrix3.0-C)
  3.     id AA15604; Tue, 7 Jul 92 14:31:52 -0400
  4. Date: Tue, 7 Jul 92 14:31:52 -0400
  5. From: jlynch@wilkes1.wilkes.edu (Baloo the Bear)
  6. Message-Id: <9207071831.AA15604@wilkes1.wilkes.edu>
  7. To: ktso@ws332c.ee.cuhk.hk
  8. Subject: BotDoc1.2
  9. Status: R
  10.  
  11.  
  12. ************************************************************************
  13.  
  14. That Great Ursine of IRC, BalooBear, presents...
  15.  
  16.  '||''|.             .   '||''|.                  
  17.   ||   ||    ...   .||.   ||   ||    ...     .... 
  18.   ||'''|.  .|  '|.  ||    ||    || .|  '|. .|   ''    Version
  19.   ||    || ||   ||  ||    ||    || ||   || ||           1.2
  20.  .||...|'   '|..|'  '|.' .||...|'   '|..|'  '|...'
  21.                                                   
  22. The official guide to writing IRC bots !!!!!
  23.  
  24. ***********************************************************************
  25.  
  26. Standard Disclaimer Legal Junk
  27. ------------------------------
  28.       BalooBear cannot he held responsible for anything that happens 
  29.       as a result of using this document... Use at your own risk!!!!
  30.  
  31. Requirements
  32. ------------
  33.   o UNIX or compatible OS
  34.   o IRCII client
  35.   o A little knowledge of how /on commands work
  36.   o Imagination
  37.  
  38. What is a bot?
  39. --------------
  40.      A 'bot' is simply a collection of commands (a script) that responds
  41. to certain key phrases and commands from its owner and other IRC
  42. participants.  Popular features that people include in their bots are
  43. auto-opping of themselves and friends, deop protection for them
  44. (when someone deops them, the bot reops them), responding to certain
  45. words people say with cute responses, and the like.  This manual will
  46. show you how to do all these things, and I hope it will spur you on
  47. to make bots that do even more.  This manual only covers the basics, but
  48. bots can do MUCH more.
  49.  
  50. Mechanics of a bot
  51. ------------------
  52.      A bot appears as a seperate person on IRC, even though it is
  53. really just a script.  Your bot will have the same system address
  54. as you, and will run as a background task in your account.  Bots
  55. can leave IRC when you do automatically and change channels with
  56. you.  They can even be made to stay on IRC after you logout,
  57. 24-hrs/day, if so desired.
  58.  
  59.      A bot is just a collection of mostly /on commands (with some
  60. others thrown in sometimes) that is stored in a simple ASCII text
  61. file.  This file can be loaded into IRCII in several ways.  Since
  62. I assume most of you want your bot to run in the background and cause
  63. a minimum amount of hassle to you, I will show you the method I use
  64. to run my bot.  This method has many advantages.  But first, lets
  65. get into some actual bot code!
  66.  
  67. Common commands in a bot file
  68. -----------------------------
  69.      The first thing you'll want to have in your bot file is a
  70. nickname for your bot.  Usually, bot nicknames end in "bot" or "serv"
  71. or "srv".  You should make your bot's nick end in one of these three
  72. ways so as to not make people think it's a person.  BalooBot, my bot,
  73. is a good example.  When people see that kind of ending, they know he's
  74. just a program.  To specify a nickname, put this in your bot file:
  75.  
  76.      /nick whatever
  77.  
  78.      Remember, just use any text editor to make your bot file, as it is
  79. only an ASCII text file.
  80.      Next you should set exec_protection to off, so that your bot can
  81. operate properly, turn the display off, and turn the beep off by doing
  82. this:
  83.  
  84.      /set exec_protection off
  85.      /set display off
  86.      /set beep off
  87.  
  88.      Simple, eh?  Now we get to the good part - actually writing
  89. the key phrases and responses!!!  Many things can be done with a
  90. bot, and here are a few:
  91.  
  92. /ON PUBLIC - RESPONDING TO KEY PHRASES
  93. --------------------------------------
  94.      By using /on public commands, your bot can be made to respond to
  95. "key phrases" that anyone on the channel says.  Wildcards, such as *,
  96. can be used, and case does not matter.  The first form of the command
  97. responds to a key phrase only when the bot is specifically spoken to:
  98.  
  99.      /on public "* baloobot* hello*" / ==== Hi there, $0! ====
  100.      /on public "* hello* baloobot*" / ==== Hi there, $0! ====
  101.  
  102.      This line will respond with "==== Hi there, Fred! ====" if
  103. someone named Fred says "baloobot hello" or "hello baloobot".  This
  104. type of public will ONLY respond when someone specifically addresses
  105. the bot by name.  Another kind of /on public is this kind:
  106.  
  107.      /on public "* spam*" / ==== SPAM, SPAM, SPAM, SPAMMITY SPAM! ====
  108.  
  109.      ...which will output the phrase whenever the word "spam" is heard
  110. from anyone at any time.  BE WARNED, however, that most people do not
  111. take kindly to this kind of /on public statement, and will usually
  112. kick your bot if he keeps it up.  By making the bot only respond when
  113. addressed, you can make sure that it doesn't get people annoyed.
  114.      See the listing of BalooBot after this document for more ideas.
  115.  
  116. /ON MSG - RESPONDING TO MESSAGES
  117. --------------------------------
  118.      /on msg commands allow your bot to respond to /msg messages that
  119. people send to it.  The format is similar to /on public :
  120.  
  121.      /on msg "* help*" /exec -msg $0 cat HelpFile.txt
  122.  
  123.      ...will, when someone types "/msg BalooBot help", msg back to
  124. that person the contents of the file HelpFile.txt in the current dir.
  125. Bascially, anything that can be done with /on publics can also be
  126. done with /on msgs, the two commands simply respond to different
  127. kinds of input.  BalooBot's listing at the end of this document
  128. includes several /on msg commands, mostly for owner control.
  129.  
  130. AUTO-OPS and AUTO-REOPS
  131. ------------------------
  132.      Auto-ops can be incorporated into your bot, which will make
  133. him op you or any of your friends automatically and instantly upon /join
  134. of the channel the bot is on (assuming he is opped).  Auto-reops
  135. automatically reop you or friends when someone tries to deop you/them.
  136. Here is an example from BalooBot:
  137.  
  138.      /on join BalooBear /mode $C +o BalooBear; ==== BALOOBEAR!! ====
  139.      /on mode "* * *-O BalooBear" /mode $C +o BalooBear
  140.  
  141.      The first line auto-ops BalooBear upon joining the channel
  142. the bot is on (notice how $C represents the channel name).  The second
  143. line reops BalooBear immediately if somebody deops him.  See the
  144. listing of BalooBot for more examples.  Also note how a semicolon (;)
  145. is used to separate multiple commands on the same line.
  146.  
  147. SECURE (LOGIN-ID) BASED AUTO-OP
  148. -------------------------------
  149.      The previous auto-op commands will auto-op anyone with the right
  150. nickname.  On small channels this is usually no problem, but on large,
  151. well-known channels (such as #hottub, which is BalooBot's home), this
  152. can become a problem, as delinquents can take someone else's nick, get
  153. auto-opped by the bot (who think's its that person of that nick), and
  154. mass-kick everyone off the channel :(.... A way to avoid this is by
  155. using secure auto-opping that is based on login-id rather than just
  156. nickname.  Here's how: put this line once in your botfile, near
  157. the top:
  158.  
  159.      /on join * /who $0
  160.  
  161.      ...then for each person you want to auto-op, put in one of
  162. these:
  163.  
  164.      /on who "* * * jlynch wilkes1.wilkes.edu *" /mode $C +o $1
  165.  
  166.      Make sure to leave out the @ in the system address.
  167. Incidentially, the above one is just an example, but it would be
  168. nice to add to your bot (after all, I wrote this helpfile :)
  169.  
  170. KICK PROTECTION (AUTO-REJOIN-ON-KICK)
  171. -------------------------------------
  172.      Add something like this to make your bot kick-proof:
  173.  
  174.      /on raw_irc "*KICK * * BalooBot*" /msg BalooBot rejoin
  175.      /on msg "BalooBot rejoin" /join #channel
  176.  
  177.      BTW, you can't just do a /on raw_irc kick /join, because all
  178. operations after the raw_irc are carried out JUST BEFORE you are
  179. kicked... so having the bot msg itself to rejoin is a neccessary,
  180. if kludgy, extra step.  But hey... it works! :)
  181.  
  182.      Of course, someone can always ban your bot, then kick him.
  183. To get around this, simply put your bot on a non-2.7 server, with
  184. the /serv command.  Non-2.7 servers ignore bans, and essentially
  185. make your bot ban-proof.  Along with the next section on kill-
  186. proofness, these things will make it so that NO ONE on IRC, and I
  187. do mean NO ONE, will be able to get your bot off a channel in
  188. any way (KICK doesn't work, ban doesn't either, not even KILL!).
  189. Except possibly by making the channel invite-only, but on most
  190. big public-channels like #hottub, invite-only is almost never used.
  191.  
  192. KILL-PROOFNESS
  193. --------------
  194.      One simple line will make your bot kill-proof (instant
  195. reconnect upon kill):
  196.  
  197.      /on disconnect * /serv servername
  198.  
  199.      ...where you substitute your server name (for example,
  200. fairhope.andrew.cmu.edu, a good non-2.7 server) for the word
  201. "servername".
  202.  
  203. OWNER COMMANDS
  204. --------------
  205.      These commands use /on public statements, but can only be
  206. activated by the owner of the bot, not by anyone else.  The key is
  207. to include the owner's name as part of the statement:
  208.  
  209.      /on public "BalooBear bbot boot*" /kick $C $3
  210.  
  211.      ...will kick the person after the word "boot" off the channel.
  212. Note that all BalooBear has to type is "bbot boot nick" to kick
  213. that person, the "BalooBear" part of the /on public is only used
  214. to make sure that the command is from BalooBear; someone else trying
  215. to use the "bbot boot" command will get no response.
  216.      BalooBot also includes /on msg owner commands, for when the
  217. owner is not on the same channel as the bot.
  218.  
  219. JOIN-ON-INVITE
  220. --------------
  221.      This command will make the bot join any channel its owner
  222. /invites it to (make sure to put your nick in place of "BalooBear")
  223.  
  224.      /on invite "BalooBear" /join $1
  225.  
  226. SWITCH SERVERS
  227. --------------
  228.     This is a special owner command that causes the bot to switch
  229. to whatever server you tell it to:
  230.  
  231.      /on public "BalooBear BBot serv*" /serv $3
  232.      /on msg "BalooBear serv *" /serv $2
  233.  
  234.      so when BalooBear types "bbot serv lyman.pppl.gov" or
  235. "/msg BalooBot serv lyman.pppl.gov", BalooBot will switch to the
  236. lyman server.
  237.  
  238. EXIT-WITH-OWNER
  239. ---------------
  240.      This command will cause your bot to exit the IRC system when
  241. you do, automatically.  Note that if you want a bot to be on all
  242. the time, do not use this command, you must kill the bot process
  243. from the shell to stop it.
  244.  
  245.      /on channel_signoff "* BalooBear" /exit
  246.  
  247. STARTING YOUR BOT
  248. -----------------
  249.      OK, so you've written your bot, and now you want to try him out.
  250. Here's how, assuming you have a C-shell-based UNIX system (commands
  251. may vary for other shells):
  252.  
  253.      1. From the shell prompt, simply type:
  254.  
  255.         irc -b -l botfile
  256.  
  257.      ...where you replace the full pathname of the IRCII client
  258. on your machine for the word 'irc', and the name of the ASCII text
  259. file containing your bot for the word 'botfile'.
  260.      This will run your bot in the background, put up some stuff
  261. on the screen you should ignore, and then, after you hit return a
  262. few times, return your shell prompt to you.  The bot is now running
  263. as a background process that will continue indefinitely until you
  264. kill it, even after you logout.
  265.  
  266.      2. Now just join IRC yourself, take the nickname that your
  267. bot recognizes as its master's... and have fun!
  268.  
  269.      3. If you ever want to kill the bot for any reason (to start
  270. up an improved version, for example), just do a "ps -x" from the
  271. shell prompt, note the PID number of the bot process, and from the
  272. shell type "kill -9 pidnumber", replacing the PID number for the
  273. word "pidnumber".
  274.  
  275. CONCLUDING NOTE
  276. ---------------
  277.      Keep in mind that MUCH more can be done with bots, so much more that
  278. we have literally only covered the proverbial "tip of the iceberg" here.
  279. So go ahead, and get your hands dirty...  If you have any questions,
  280. I'm on IRC under "BalooBear", you can talk to me or leave a msgserv
  281. for me, or E-mail me at jlynch@wilkes1.wilkes.edu
  282.                                              _
  283.                                             /\\_\_.-----.___  _.._
  284.                                               / _    _      \//   \
  285.   BalooBear                                  / /      \       y--  |
  286.   John Lynch                                 |  /\  /\        \ __/
  287.   jlynch@wilkes1.wilkes.edu       ___________| _*/__*/_        \_
  288.                                  /   \\      +----.    ____      \_
  289.   -------------------------      \    ||           \__/ / /        \
  290.                                   +---+/               / /        /\\
  291.   High Byte Software               \ \                / /       _/
  292.   91 Hillside Street                '-+----_______---- /      --  \
  293.   Wilkes-Barre, PA, USA                 \___________--'            \
  294.   18702                                       /                     \
  295.                                              /                       \
  296.  
  297.  
  298. ================= LISTING OF BALOOBOT AS OF 4/9/92 ====================
  299.  
  300.  
  301. /comment *** BalooBot V3.7, BalooBear's IRC bot ***
  302. /comment *** now running off Fizzy's account ***
  303. /comment *** jointly commanded/owned by Fizzy/BalooBear ***
  304.  
  305. /comment *** Now with system-id checks (for auto-opping) ***
  306. /comment *** Also with kick protection (auto-rejoin on kick) ***
  307. /comment *** And kill-protection (instant auto-reconnect on kill) ***
  308. /comment *** running off a 2.6 server for ban protection ***
  309.  
  310. /serv fairhope.andrew.cmu.edu
  311.  
  312. /nick BalooBot
  313. /set novice off
  314. /set display off
  315. /set exec_protection off
  316. /set beep off
  317. /join #hottub
  318. /say ==== Hi everyone! ====
  319. /on join * /who $0
  320.  
  321. /comment ******************** PUBLICS ****************************
  322.  
  323. /on mode "* * *+O BalooBot*" /msg $0 ==== Thanks tons, $0!! ====
  324. /on public "* hello* BalooBot" / ==== Hi there, $0!! ====
  325. /on public "* BalooBot* hi*" / ==== Hello, $0!!! ====
  326. /on public "* BalooBot* hello" / ==== Greetings, $0!! ====
  327. /on public "* hi* BalooBot*" / ==== What's up, $0 ?!! ====
  328. /on public "* baloobot* thank*" / ==== No problemo, $0 ====
  329. /on public "* thank* baloobot*" / ==== Anytime, $0 ====
  330. /on public "* thanx* baloobot*" / ==== Don't mention it, $0!!! ====
  331. /on public "* baloobot* thanx*" / ==== Glad to help, $0!!! ====
  332. /on public "* baloobot* spam*" / ==== SPAM, SPAM, SPAM, SPAM, SPAMMITY SPAM!! ====
  333. /on public "* baloobot* amiga*" / ==== Commodore Amiga - Best PC on Earth!! ====
  334. /on public "* baloobot* commodore*" / ==== Commodore : maker of the legendary AMIGA! ====
  335. /on public "* baloobot* parrot*" / ==== "That parrot is NOT dead.. he's resting!" ====
  336. /on public "* baloobot* grail*" / ==== "Grail?  We've already got one!" ====
  337. /on public "* baloobot* sir robin*" / ==== "He is brave Sir Robin, brave Sir Robin" ====
  338. /on public "* baloobot* larch*" / ==== "AND NOW... THE LARCH" ====
  339. /on public "* baloobot* camelot*" / ==== "It's only a model!" ====
  340. /on public "* baloobot* floyd*" / ==== PINK FLOYD RULES! ====
  341. /on public "* baloobot* how* is* life*" / ==== Life sucks, as usual, $0 ====
  342. /on public "* baloobot* eat* me*" / ==== $0: I'd rather not :P ====
  343. /on public "* baloobot* who* made* you*" / ==== BalooBear did, of course! ====
  344. /on public "* baloobot* who* created* you*" / ==== BalooBear made me! ====
  345. /on public "* baloobot* who* is* your* master*" / ==== My master is BalooBear!  I obey him faithfully! ====
  346. /on public "* baloobot* self*destruct*" / ==== BLAM!!!!!!! ====
  347. /on public "* baloobot* who* is* BalooBear*" / ==== BalooBear is the bear from the Disney ====; ==== film, "The Jungle Book".  And he is my master! ====
  348. /on public "* baloobot* me* beer*" / ==== Throws a cold brewski to $0 ====
  349. /on public "* baloobot* where* you* live*" / ==== I live on IRC, silly! :) ====
  350. /on public "* baloobot* die*" / ==== DIE??? I AM IMMORTAL!!!! :) ====
  351. /on public "* baloobot* sex*" / ==== *blushes* Sorry, bots can't have sex, $0 ====
  352. /on public "* baloobot* suck*" / ==== $0, vulgarity is a crutch for the inarticulate ====
  353. /on public "* baloobot* go* hell*" / ==== No, I think YOU should go to hell, $0!!! :) ====
  354. /on public "* baloobot* fuck*" / ==== Watch the language, $0!!! :) ====
  355. /on public "* baloobot* shit*" / ==== Watch the language, $0, or I'll ====; ==== get the FCC after you! :) ====
  356. /on public "* baloobot* shut*up*" / ==== I'll shut up if you don't egg me on!! ====
  357.  
  358. /comment ******************** HELP! *********************************
  359.  
  360. /on public "* baloobot* help*" /msg $0 ==== HELP??  Call 911 !! ====
  361. /on public "* bbot* help*" /msg $0 ==== HELP??  Call 911 !! ====
  362. /on msg "* help*" /msg $0 ==== HELP??  Call 911 !! ====
  363.  
  364. /comment ******************* KICK / KILL PROTECTION ********************
  365.  
  366. /on raw_irc "*KICK * * BalooBot*" /msg BalooBot rejoin
  367. /on msg "BalooBot rejoin" /join #hottub
  368.  
  369. /on disconnect * /serv fairhope.andrew.cmu.edu
  370.  
  371. /comment ******************** AUTO RE-OPS *************************
  372. /comment *** inactive until I can figure out how to secure them ***
  373. /comment *** from jerks who take other ppl's nicks to get opped ***
  374.  
  375. /comment /on mode "* * *-O BalooBear*" / ==== NEVER DEOP MY MASTER, $0!!! ====;/mode $C +o BalooBear
  376. /comment /on mode "* * *-O Fizzy*" / ==== LEAVE MY CO-OWNER ALONE, $0!!! ====;/mode $C +o Fizzy
  377. /comment /on mode "* * *-O RontuWolf*" / ==== NEVER DEOP MY MASTER, $0!!! ====;/mode $C +o BalooBear
  378. /comment /on mode "* * *-O Dankari*" /mode $C +o Dankari
  379. /comment /on mode "* * *-O Zorg*" / ==== HEY!! LEAVE ZORG ALONE!! *reops Zorg* ====;/mode $C +o Zorg
  380. /comment /on mode "* * *-O Christina*" / ==== LEAVE HER ALONE!!! *reops Christina* ====;/mode $C +o Christina
  381. /comment /on mode "* * *-O kodiak*" / ==== LEAVE MY BEAR BUDDY ALONE!!! ====;/mode $C +o kodiak
  382. /comment /on mode "* * *-O DreadLord*" / ==== DON'T MESS WITH DREADLORD!! *reops him* ====;/mode $C +o DreadLord
  383. /comment /on mode "* * *-O ce_nedra*" / ==== HEY!! LEAVE CE_NEDRA ALONE!! *reops* ====;/mode $C +o ce_nedra
  384. /comment /on mode "* * *-O snick*" / ==== HEY!! LEAVE SNICK ALONE!! *reops* ====;/mode $C +o snick
  385. /comment /on mode "* * *-O rags*" / ==== LEAVE RAGS ALONE!!! *reops him* ====;/mode $C +o rags
  386. /comment /on mode "* * *-O stale*" / ==== LEAVE STALE ALONE!! *reops* ====;/mode $C +o Stale
  387. /comment /on mode "* * *-O HotTubSrv*" / ==== LEAVE HOTTUBSRV ALONE!! ====;/mode $C +o HotTubSrv
  388. /comment /on mode "* * *-O Nap*" / ==== LEAVE NAP ALONE!! ====;/mode $C +o Nap
  389.  
  390. /comment ******** COMMANDS FOR BALOOBEAR / FIZZY *****************
  391.  
  392. /on msg "BalooBear op*" /mode $C +o $2
  393. /on msg "BalooBear deop*" /mode $C -o $2
  394. /on msg "BalooBear boot*" /kick $C $2
  395. /on msg "BalooBear later" /say ==== BYE ALL!!! ====;/exit LATER_ALL!
  396. /on msg "BalooBear serv*" /serv $2
  397. /on msg "BalooBear join*" /join $2
  398. /on msg "BalooBear leave*" /leave $2
  399. /on msg "BalooBear nick*" /nick $2
  400. /on msg "BalooBear ban*" /kick $C $2;/mode $C +b $2!*@*
  401.  
  402. /on msg "Fizzy op*" /mode $C +o $2
  403. /on msg "Fizzy deop*" /mode $C -o $2
  404. /on msg "Fizzy boot*" /kick $C $2
  405. /on msg "Fizzy later" /say ==== BYE ALL!!! ====;/exit LATER_ALL!
  406. /on msg "Fizzy serv*" /serv $2
  407. /on msg "Fizzy join*" /join $2
  408. /on msg "Fizzy leave*" /leave $2
  409. /on msg "Fizzy nick*" /nick $2
  410. /on msg "Fizzy ban*" /kick $C $2;/mode $C +b $2!*@*
  411.  
  412.  
  413. /comment ********************** THE END ************************
  414. /comment ****** BalooBot V3.7, a BalooBear production :) *******
  415.  
  416.  
  417.  
  418. '''---```---^^^^^^-----#-----~~~~~----'''------~~~~-----````~~~---------=\ /=
  419. .sig (n): a piece of mail with a fool at one  :  Ravi Narayan, CS, WPI   (0)
  420.           end and flames at the other. (C).   :  DoD #540 - SuzukiGS500E  H
  421.    o     _          _           _           _ :         _           _     H
  422.  _/\_> =| |========| |=========| |=========| |=========| |=========| |=======
  423. 0,> /0,=|w|,,=====,|,|.,===,,==| |,,===.,==|.|..======w| |..,,.====| |====,,=
  424.  
  425.  
  426.